<?php header('Content-type: text/html; charset=UTF-8'); ?>
<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
  
<?php

    // Konstante za URL
    define('BASE_URL',base_url());
    if( "" != $this->uri->segment(1) )
      define('CONTROLLER_URL',base_url().$this->uri->segment(1).'/');
    else
      define('CONTROLLER_URL',base_url().'home/');
    define('REFRESH_TIME',$this->config->item('refresh_time'));    
    
    $spotlight_cost = $this->config->item('spotlight_cost');
    
    ?>
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-type" value="text/html; charset=UTF-8" /> 
  <meta charset="utf-8">
  <title><?php echo $title; ?> </title>
  <meta name="Keywords" content="<?php echo $keywords; ?>">
  <meta name="Description" content="<?php echo $description; ?>">
  
  <!-- Set javascript URL's -->
    <script type="text/javascript">
        var BASE_URL = "<?=BASE_URL;?>"; 
        var AJAX_URL = "<?=BASE_URL?>ajax/"
        var CONTROLLER_URL = "<?=CONTROLLER_URL?>"; 
        var REFRESH_TIME = <?=REFRESH_TIME?>000;
        var MESSAGE_PRICE = <?php echo $this->config->item('message_cost'); ?>;
        var MESSAGE_LEN = <?php echo $this->config->item('message_lenght'); ?>;
    </script>
  
  <link href="<?php echo base_url(); ?>favicon.ico" rel="icon" type="image/x-icon" />
  <link href="<?php echo base_url(); ?>css/style.css" rel="stylesheet" type="text/css">
  
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="<?php echo base_url(); ?>js/jquery.validate.js"></script>
  <script src="<?php echo base_url(); ?>js/login.js"></script>
  <script src="<?php echo base_url(); ?>js/register.js"></script>
  <script src="<?php echo base_url(); ?>js/dialog.js"></script>
  <!--Home Slider-->
  <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/elastislide.css" />
  <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/custom.css" />
  <script type="text/javascript" src="<?php echo base_url(); ?>js/home-bg-slider.js"></script>
  <!--End Home Slider-->
  
  <!-- Ajax Upload -->
  <script src="<?=base_url()?>js/jQueryUpload/jquery.ui.widget.js"></script>
  <script src="<?=base_url()?>js/jQueryUpload/jquery.iframe-transport.js"></script>
  <script src="<?=base_url()?>js/jQueryUpload/jquery.fileupload.js"></script>
  
  <!--Colorbox-->
  <link rel="stylesheet" href="<?php echo base_url(); ?>css/colorbox.css" />
  <script src="<?php echo base_url(); ?>js/jquery.colorbox.js"></script>
  <!--End Colorbox-->
  
  <!-- jQuery UI -->
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  
  <!-- virtualpaginate -->
  <script src="<?php echo base_url(); ?>js/virtualpaginate.js"></script>
  
  <!--  -->
  <script src="<?php echo base_url(); ?>js/script.js"></script>
  
</head>
<body>
  
  
  <div id="f_header">
 	<header>
    	<div class="f_container">
        	<div class="logo">
            	<a href="<?php echo ($this->session->userdata('user_logged'))?base_url()."profile.htm":base_url();?>"><img src="<?php echo base_url();?>img/template/logo.png" width="324" height="115" alt="datyy" /></a>
                
            </div><!--end logo-->
            
            <!-- Login Starts Here -->
            <div id="loginContainer">
                <?php if( true == $this->session->userdata('user_logged') ) { /* USER LOGGED */ 
                
                if( $this->session->userdata('main_img')!="" )
                  $img = "<img id='profile-thumb' src='".base_url()."profile/image/thumb/".$this->session->userdata('user_id')."/".$this->session->userdata('main_img')."' alt='' /> ";
                else
                  $img = "<img id='profile-thumb' src='".base_url()."img/no_photo.gif' alt='' />";
                 
                
                ?>              
                <div id="loginButton"><p id="loginButton" class="login"> <?php echo $img; ?> <span><?php echo( $this->session->userdata('name')!="" )?$this->session->userdata('name'):$this->session->userdata('username'); ?></span></p>
                <div class="clr"></div>
                </div><div class="clr"></div>
                <div style="clear:both"></div>
                <div id="loginBox">                
                    <div id="user-set">
                        <ul>
                        <li class="profil-dd"><a href="<?php echo base_url();?>profile.htm"><?php echo lang('menu_my_profile'); ?></a></li>
                    	<li class="edit-profil-dd"><a href="<?php echo base_url();?>profile/edit-profile.htm"><?php echo lang('edit_profile'); ?></a></li>
                        <li class="my-friends-dd"><a href="<?php echo base_url();?>friends.htm"><?php echo lang('my_friends'); ?></a></li>
                        <li class="my-spotlight-dd"><a href='javascript:add_to_spotlight()' class=' confirmLink' name='' title='<?php printf(lang('add_to_spotlight_confirm'),$spotlight_cost);?>' alt='<?php printf(lang('add_to_spotlight_confirm'),$spotlight_cost);?>' ><?php echo lang('add_to_spotlight'); ?></a></li>
                        <li class="view-profil-dd">
                          
                                
           <?php 
           $view_price = $this->config->item('who_viewed_profile_cost');
                //if( false == $this->session->userdata('is_pay_who_viewed_profile') ) 
               /* { 
                  $view_price = $this->config->item('who_viewed_profile_cost');
                  ?>  
                    onclick="return confirm('<?php printf(lang('confirm_view_whos_viewed_my_profile'),$view_price); ?>')" 
          <?php }*/ ?> 
                             <a href="<?php echo base_url(); ?>profile/whos-viewed-my-profile.htm" class="_no_confirmLink" title='<?php echo lang('whos_viewed_my_profile');?>' alt='<?php printf(lang('confirm_view_whos_viewed_my_profile'),$view_price);?>' 
                            ><?php echo lang('whos_viewed_your_profile'); ?></a></li>
                        <li class="add-coins-dd"><a href="<?php echo base_url();?>payment.htm"><?php echo lang('load_coins'); ?></a></li>
                        <li class="logout-dd"><a href="javascript:void(null)" id='logout'><?php echo lang('logout'); ?></a></li>
                    </ul>
                    </div>
                </div>           
              
                <?php
                      } else { /* USER NOT LOGGED */
                ?>                
                <div id="loginButton"><p id="loginButton"><?php echo lang('login_title'); ?></p></div>
                <div style="clear:both"></div>
                <div id="loginBox">                
                    <form id="loginForm">
                        <fieldset id="body">
                            <fieldset>
                                <label><?php echo lang('username'); ?>:</label>
                                <input type="text" id="username" name="login[username]" />
                            </fieldset>
                            <fieldset>
                                <label for="password"><?php echo lang('password'); ?>:</label>
                                <input type="password" name="login[password]" id="password" />
                            </fieldset>
                            <input type="button" id="login" value="<?php echo lang('login_title'); ?>" />
                                                        
                            <label for="checkbox"><input type="checkbox" id="checkbox" name="login[remember]" value="1"/><?php echo lang('remember_me'); ?></label>
                            
                        </fieldset>
                        <div id="response_login"></div>
                        <span><a href="<?php echo base_url(); ?>register/forgot-password.htm"><?php echo lang('forgot_password'); ?>?</a> | <a href="<?php echo base_url(); ?>register.htm"><?php echo lang('register_now'); ?></a></span>
                    </form>
                </div>
                <?php } ?>
            </div>
            <!-- Login Ends Here -->
           
            <div class="top_nav"> 
                <?php if( false == $this->session->userdata('user_logged') ) {  ?>
            	<ul>
                	<li><a <?php if("home" == $menu_active) echo " class='active'";?> href="<?php echo base_url(); ?>"><?php echo lang('home'); ?></a></li>
                    <li><a <?php if("search" == $menu_active) echo " class='active'";?> href="<?php echo base_url(); ?>search.htm"><?php echo lang('search'); ?></a></li>
                    <li><a <?php if("news" == $menu_active) echo " class='active'";?> href="#"><?php echo lang('news'); ?></a></li>
                    
                </ul> 
                <?php }  ?>
            </div><!--end top_nav-->
			<!--
            <div class="num_online"><?php echo lang('num_online')." <span id='num_online'>0</span> ".lang('user_s'); ?></div>
			-->
        </div><!--end f_container-->
        <div class="clr"></div>
    </header>
  </div><!--end f_header-->
  
  <script>
    
    setInterval(update_num_online, REFRESH_TIME); 
    //update_num_online();
    <?php if( true == $this->session->userdata('user_logged') ){ ?>
    setInterval(update_right_part_menu, REFRESH_TIME); 
    update_right_part_menu();
    <?php } ?>
  </script>